import JobInterface from './JobInterface'
import JobStatus from './JobStatus'
import uuid from '../utils/uuid'

export default class Job implements JobInterface {

  private id: string
  private url: string
  private createTime: number
  queueName: string
  tryNum: number
  status: JobStatus

  getId (): string {
    return this.id
  }

  getUrl (): string {
    return this.url
  }

  setQueueName (name: string) {
    this.queueName = name
  }

  setTryNum (tryNum: number) {
    this.tryNum = tryNum
  }

  setStatus (status: JobStatus) {
    this.status = status
  }

  setCreateTime (time) {
    this.createTime = time
  }

  getCreateTime () {
    return this.createTime
  }

  constructor (url: string) {
    this.id = uuid()
    this.createTime = new Date().getTime()
    this.url = url
  }
}